package com.example.homeworkrabbitmq.controller;

import com.example.homeworkrabbitmq.entity.Course;
import com.example.homeworkrabbitmq.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/course")
public class CourseController {
    @Autowired
    private CourseService courseService;

    @RequestMapping("/list")
    public String list(Model model){
        List<Course> list = courseService.list();
        model.addAttribute("courseList",list);
        return "course";
    }
}
